# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : zsj.py
# @Time     : 2024/4/8 23:00
# @Author   : Robot-Zsj
"""
description:

input
3 15 6 14
output
3 21 9 17
"""

prices = list(map(int, input().split()))


def getResult():
    res = []
    res.extend(prices)

    stack = []

    n = len(prices)

    for j in range(n * 2):
        prices_j = prices[j % n]
        while len(stack) > 0:
            i = stack[-1]

            if prices[i] > prices_j:
                stack.pop()
                res[i] += prices_j
            else:
                break

        if j < n:
            stack.append(j)

    return " ".join(map(str, res))


print(getResult())
